/****************************************************************************
 **
 ** Copyright (C) 2019 SINOSIND, Inc.
 ** All rights reserved.
 ** Author: Sun Haihua <myspl@msn.com>
 ** Contact: SINOSIND 400-060-9902
 **
 ** This file is part of the NJY System.
 **
 ** Commercial Usage
 ** Licensees holding valid NJY Commercial licenses may use this file in
 ** accordance with the NJY Commercial License Agreement provided with the
 ** Software or, alternatively, in accordance with the terms contained in
 ** a written agreement between you and SINOSIND.
 **
 ** If you have questions regarding the use of this file, please contact
 ** SINOSIND at http://agrij.com
 **
 ****************************************************************************/

const { resolve, dirname } = require("path");
const dir = (...argv) => resolve(__dirname, ...argv);
const src = (...argv) => dir("src", ...argv);
const dest = (...argv) => dir('dest', ...argv);

module.exports = {
    mode: "production",
    // entry: src('cpage.js'),
    entry: "./startup.js",
    output: {
        path: src('../assets/sz/js/'),
        filename: "_start_.js"
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
            }
        ]
    },
    devServer: {
        port: 7080,
        host: '127.0.0.1',
        contentBase: __dirname,
        hot: true,
        proxy: {
            '/api': {
                target: 'http://172.0.0.230:7080/api', //预生产环境
                ws: true,
                changeOrigin: true,
                pathRewrite: { '^/api': '' }
            }

        }
    }
};


